﻿using System;

namespace ProjectEuler
{
    class Problem6
    {
        public double Solve()
        {
            // Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
            // http://www.proofwiki.org/wiki/Sum_of_Sequence_of_Squares
            var squareOfSum = Math.Pow((100*101)/2, 2);

            double sumOfSquare = 0;

            for(double i=1; i < 101; i++)
            {
                sumOfSquare += Math.Pow(i, 2);
            }

            return squareOfSum - sumOfSquare;
        }

    }
}
